#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n62_lhu_test)
    .set noreorder
    addiu s0, s0, 1
    li  s2, 0x0
###test inst
    TEST_LHU(0xc5e0fd00, 0x800d1dfc, 0x0000b55e, 0x0000b55c, 0x0000c5e0)
    TEST_LHU(0x258707b2, 0x800dbd8c, 0x00001c34, 0x00001c34, 0x000007b2)
    TEST_LHU(0x263aa087, 0x800d6920, 0x0000641a, 0x00006418, 0x0000263a)
    TEST_LHU(0xb5e11b1a, 0x800d3a6c, 0x00005164, 0x00005164, 0x00001b1a)
    TEST_LHU(0xc972f764, 0x800d14a0, 0x000002cc, 0x000002cc, 0x0000f764)
    TEST_LHU(0x9cc84d98, 0x800d0160, 0x00001268, 0x00001268, 0x00004d98)
    TEST_LHU(0x75e313d0, 0x800d993c, 0x0000456c, 0x0000456c, 0x000013d0)
    TEST_LHU(0x6d19e13e, 0x800db968, 0x000035de, 0x000035dc, 0x00006d19)
    TEST_LHU(0x4a1efc6c, 0x800d5a08, 0x0000a2f0, 0x0000a2f0, 0x0000fc6c)
    TEST_LHU(0x32e321c0, 0x800d41d4, 0x00006844, 0x00006844, 0x000021c0)
    TEST_LHU(0x7977fa5c, 0x800d4e38, 0x00003380, 0x00003380, 0x0000fa5c)
    TEST_LHU(0x43106c00, 0x800d7bf8, 0x000078ca, 0x000078c8, 0x00004310)
    TEST_LHU(0x43abd100, 0x800d7718, 0x00006cd6, 0x00006cd4, 0x000043ab)
    TEST_LHU(0xdd8dafc0, 0x800d66c0, 0x00005b08, 0x00005b08, 0x0000afc0)
    TEST_LHU(0x46dfa15e, 0x800d086c, 0x00005220, 0x00005220, 0x0000a15e)
    TEST_LHU(0x592810c0, 0x800d1438, 0x0000e178, 0x0000e178, 0x000010c0)
    TEST_LHU(0xb8f4f244, 0x800d30d0, 0x00001944, 0x00001944, 0x0000f244)
    TEST_LHU(0xa32605e0, 0x800d6c44, 0x00000a88, 0x00000a88, 0x000005e0)
    TEST_LHU(0x644ab840, 0x800d0200, 0x0000fbee, 0x0000fbec, 0x0000644a)
    TEST_LHU(0xc9b5aa10, 0x800d6b08, 0x00002200, 0x00002200, 0x0000aa10)
    TEST_LHU(0x97bde956, 0x800d5160, 0x000019d0, 0x000019d0, 0x0000e956)
    TEST_LHU(0x8915acea, 0x800d0210, 0x00007a2e, 0x00007a2c, 0x00008915)
    TEST_LHU(0x7952a818, 0x800d35d4, 0x0000b39e, 0x0000b39c, 0x00007952)
    TEST_LHU(0x457f0d3d, 0x800d6044, 0x000059e0, 0x000059e0, 0x00000d3d)
    TEST_LHU(0x81a3f580, 0x800d7588, 0x00000ab4, 0x00000ab4, 0x0000f580)
    TEST_LHU(0xe9fde394, 0x800d1870, 0x00007952, 0x00007950, 0x0000e9fd)
    TEST_LHU(0xbbf8bfa0, 0x800d2c9c, 0x000066da, 0x000066d8, 0x0000bbf8)
    TEST_LHU(0x1db28a00, 0x800dae60, 0x000047ea, 0x000047e8, 0x00001db2)
    TEST_LHU(0x5d6b0e7c, 0x800d0c48, 0x000027be, 0x000027bc, 0x00005d6b)
    TEST_LHU(0x57fe8940, 0x800d2030, 0x00001770, 0x00001770, 0x00008940)
    TEST_LHU(0x80030460, 0x800d2878, 0x00003b92, 0x00003b90, 0x00008003)
    TEST_LHU(0x9d1155b8, 0x800d432c, 0x00005da8, 0x00005da8, 0x000055b8)
    TEST_LHU(0x93af2e4a, 0x800d444c, 0x00004b7a, 0x00004b78, 0x000093af)
    TEST_LHU(0x64e93438, 0x800d0000, 0x0000cf1e, 0x0000cf1c, 0x000064e9)
    TEST_LHU(0x855e2566, 0x800d0000, 0x00005372, 0x00005370, 0x0000855e)
    TEST_LHU(0x68e8f220, 0x800d0000, 0x00002060, 0x00002060, 0x0000f220)
    TEST_LHU(0x155b6e78, 0x800d0000, 0x00004da8, 0x00004da8, 0x00006e78)
    TEST_LHU(0xe171e238, 0x800d0000, 0x0000f292, 0x0000f290, 0x0000e171)
    TEST_LHU(0x2d81ef10, 0x800d0000, 0x0000f260, 0x0000f260, 0x0000ef10)
    TEST_LHU(0x18243d74, 0x800d0000, 0x0000b988, 0x0000b988, 0x00003d74)
    TEST_LHU(0xd9a53a80, 0x800d0000, 0x00007866, 0x00007864, 0x0000d9a5)
    TEST_LHU(0x560ce2f8, 0x800d0000, 0x0000cec2, 0x0000cec0, 0x0000560c)
    TEST_LHU(0x5f5c7885, 0x800d0000, 0x00006040, 0x00006040, 0x00007885)
    TEST_LHU(0x4490a4d6, 0x800d0000, 0x0000b7dc, 0x0000b7dc, 0x0000a4d6)
    TEST_LHU(0x3773e260, 0x800d0000, 0x0000e7ae, 0x0000e7ac, 0x00003773)
    TEST_LHU(0xc030663c, 0x800d0000, 0x000087c0, 0x000087c0, 0x0000663c)
    TEST_LHU(0x1ae33eb0, 0x800d0000, 0x0000fad8, 0x0000fad8, 0x00003eb0)
    TEST_LHU(0x98b6446a, 0x800d0000, 0x00004a54, 0x00004a54, 0x0000446a)
    TEST_LHU(0x71408da5, 0x800d0000, 0x00001552, 0x00001550, 0x00007140)
    TEST_LHU(0xf770e08c, 0x800d0000, 0x00004f5c, 0x00004f5c, 0x0000e08c)
    TEST_LHU(0x85d9af84, 0x800d0000, 0x000098ee, 0x000098ec, 0x000085d9)
    TEST_LHU(0x6c751620, 0x800d0000, 0x00004540, 0x00004540, 0x00001620)
    TEST_LHU(0x3ee7efac, 0x800d0000, 0x00002f20, 0x00002f20, 0x0000efac)
    TEST_LHU(0x4ff944b5, 0x800d0000, 0x0000e73e, 0x0000e73c, 0x00004ff9)
    TEST_LHU(0x17f3a4e0, 0x800d0000, 0x00006cfc, 0x00006cfc, 0x0000a4e0)
    TEST_LHU(0xff7514e0, 0x800d0000, 0x00004462, 0x00004460, 0x0000ff75)
    TEST_LHU(0x343a3fd0, 0x800d0000, 0x00004b00, 0x00004b00, 0x00003fd0)
    TEST_LHU(0xdde84990, 0x800d0000, 0x0000dcd6, 0x0000dcd4, 0x0000dde8)
    TEST_LHU(0x63eae1b4, 0x800d0000, 0x0000fc1c, 0x0000fc1c, 0x0000e1b4)
    TEST_LHU(0xb89937ac, 0x800d0000, 0x00000f28, 0x00000f28, 0x000037ac)
    TEST_LHU(0x5b12d590, 0x800d0000, 0x000006ce, 0x000006cc, 0x00005b12)
    TEST_LHU(0x92469cd8, 0x800d0000, 0x0000cde0, 0x0000cde0, 0x00009cd8)
    TEST_LHU(0xf9f157b4, 0x800d0000, 0x0000026e, 0x0000026c, 0x0000f9f1)
    TEST_LHU(0x8ef24670, 0x800d0000, 0x000072c4, 0x000072c4, 0x00004670)
    TEST_LHU(0xd21dd8d4, 0x800d0000, 0x00000e6c, 0x00000e6c, 0x0000d8d4)
    TEST_LHU(0x4a817048, 0x800d0000, 0x0000ada0, 0x0000ada0, 0x00007048)
    TEST_LHU(0xc72484d3, 0x800d0000, 0x0000e128, 0x0000e128, 0x000084d3)
    TEST_LHU(0x3c69df38, 0x800d0000, 0x000061aa, 0x000061a8, 0x00003c69)
    TEST_LHU(0x40bb1d20, 0x800d0000, 0x0000cd88, 0x0000cd88, 0x00001d20)
    TEST_LHU(0x6fd077e8, 0x800d0000, 0x0000bef2, 0x0000bef0, 0x00006fd0)
    TEST_LHU(0x30655800, 0x800d0000, 0x00003cf6, 0x00003cf4, 0x00003065)
    TEST_LHU(0xa6dad5ca, 0x800d0000, 0x00004bb8, 0x00004bb8, 0x0000d5ca)
    TEST_LHU(0x0eaa0400, 0x800d0000, 0x00001250, 0x00001250, 0x00000400)
    TEST_LHU(0xeaf47838, 0x800d0000, 0x00002d30, 0x00002d30, 0x00007838)
    TEST_LHU(0x9f617ab8, 0x800d0000, 0x00000000, 0x00000000, 0x00007ab8)
    TEST_LHU(0x4d02ec52, 0x800d0000, 0x00000002, 0x00000000, 0x00004d02)
    TEST_LHU(0xf9afc020, 0x800d0000, 0x00000002, 0x00000000, 0x0000f9af)
    TEST_LHU(0xdfc9f4d0, 0x800d0000, 0x00000002, 0x00000000, 0x0000dfc9)
    TEST_LHU(0x5d92570c, 0x800d0000, 0x00000000, 0x00000000, 0x0000570c)
    TEST_LHU(0xb450b400, 0x800d0000, 0x00000002, 0x00000000, 0x0000b450)
    TEST_LHU(0x95fdc700, 0x800d0000, 0x00000000, 0x00000000, 0x0000c700)
    TEST_LHU(0x1364eca0, 0x800d0000, 0x00000002, 0x00000000, 0x00001364)
    TEST_LHU(0xa20708ef, 0x800d0000, 0x00000002, 0x00000000, 0x0000a207)
    TEST_LHU(0x029d7ff0, 0x800d0000, 0x00000002, 0x00000000, 0x0000029d)
    TEST_LHU(0xc513af92, 0x800d0000, 0x00000002, 0x00000000, 0x0000c513)
    TEST_LHU(0x17d8be62, 0x800d0000, 0x00000000, 0x00000000, 0x0000be62)
    TEST_LHU(0xbcc5cb24, 0x800d0000, 0x00000002, 0x00000000, 0x0000bcc5)
    TEST_LHU(0x44e5ce74, 0x800d0000, 0x00000000, 0x00000000, 0x0000ce74)
    TEST_LHU(0x870f5910, 0x800d0000, 0x00000000, 0x00000000, 0x00005910)
    TEST_LHU(0xa322c100, 0x800d0000, 0x00000002, 0x00000000, 0x0000a322)
    TEST_LHU(0xe64819f0, 0x800d0000, 0x00000002, 0x00000000, 0x0000e648)
    TEST_LHU(0xbd8427c0, 0x800d0000, 0x00000000, 0x00000000, 0x000027c0)
    TEST_LHU(0xc5137e48, 0x800d0000, 0x00000002, 0x00000000, 0x0000c513)
    TEST_LHU(0x5d9804c0, 0x800d0000, 0x00000002, 0x00000000, 0x00005d98)
    TEST_LHU(0xf04ca5a8, 0x800d0000, 0x00000000, 0x00000000, 0x0000a5a8)
    TEST_LHU(0xbe9c0a40, 0x800d0000, 0x00000000, 0x00000000, 0x00000a40)
    TEST_LHU(0x19989770, 0x800d0000, 0x00000002, 0x00000000, 0x00001998)
    TEST_LHU(0xa98e4e64, 0x800d0000, 0x00000002, 0x00000000, 0x0000a98e)
    TEST_LHU(0xbde42a40, 0x800d0000, 0x00000000, 0x00000000, 0x00002a40)
    TEST_LHU(0xb6a24340, 0x800d0000, 0x00000002, 0x00000000, 0x0000b6a2)
    TEST_LHU(0xadcf71e4, 0x800d0000, 0x00000000, 0x00000000, 0x000071e4)
    TEST_LHU(0x4362a106, 0x800d0000, 0x00000002, 0x00000000, 0x00004362)
    TEST_LHU(0x42f77dee, 0x800d0000, 0x00000002, 0x00000000, 0x000042f7)
    TEST_LHU(0x8def96d0, 0x800d0000, 0x00000000, 0x00000000, 0x000096d0)
    TEST_LHU(0xcf083100, 0x800d0000, 0x00000002, 0x00000000, 0x0000cf08)
    TEST_LHU(0xace84af0, 0x800d0000, 0x00000000, 0x00000000, 0x00004af0)
    TEST_LHU(0xc5d1d550, 0x800d0000, 0x00000002, 0x00000000, 0x0000c5d1)
    TEST_LHU(0xfade1c80, 0x800d0000, 0x00000000, 0x00000000, 0x00001c80)
    TEST_LHU(0x2579310c, 0x800d0000, 0x00000002, 0x00000000, 0x00002579)
    TEST_LHU(0x00000000, 0x800d0000, 0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n62_lhu_test)
